package com.ts.content.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ts.common.core.utils.Result;
import com.ts.content.entity.DiscussEntity;
import com.ts.content.service.DiscussService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/discuss")
@Slf4j
public class DiscussController {

    @Autowired
    private DiscussService discussService;

    @PostMapping("/page")
    public Page<DiscussEntity> page(@RequestBody Page<DiscussEntity> page){
        return discussService.page(page);
    }


    /**
     * 大家在聊接口
     * @return
     */
    @GetMapping("/random")
    public Result random(){
        log.debug("进入了话题接口");
        List<DiscussEntity> list = discussService.list();
        return new Result().ok(list);

    }

}
